package com.jfs.result;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Description 响应结果枚举类
 * 常见http状态码   ======> {@link  https://www.cnblogs.com/xiejunjie8888/p/16086909.html}
 * @E-mail cwm3412638@163.com
 * @Author cwm
 * @Date 2022/7/7
 */
@AllArgsConstructor
@NoArgsConstructor
public enum ResultCode implements IResultCode, Serializable {
    SUCCESS(200, "成功"),
    ACCESS_UNAUTHORIZED(401, "访问未授权"),
    FORBIDDEN(403,"权限不足"),
    /**
     * 400以内自定义响应码 必须以417开始 不能和默认400 http状态码冲突
     */
    TOKEN_INVALID_OR_EXPIRED(418, "token无效或已过期"),

    TOKEN_ACCESS_FORBIDDEN(419, "token已被禁止访问"),

    TOKEN_IS_LOGIN(420, "此账号在异地登录"),

    /**
     * 500以内自定义响应码 必须以505以后开始 不能和默认500 http状态码冲突
     */
    SYSTEM_EXECUTION_ERROR(500,"系统错误"),

    USERNAME_OR_PASSWORD_ERROR(506,"用户名或密码错误"),

    USER_NOT_EXIST(507,"用户不存在"),

    USER_ACCOUNT_INVALID(508,"用户账户已过期"),

    USER_ACCOUNT_LOCKED(509,"用户账户被冻结"),

    USER_ACCOUNT_DISABLED(501,"用户已禁用"),

    METHOD_ARGUMENT_NOT_VALID(502,"参数校验异常");

    /**
     * 响应码
     */
    private Integer code;
    /**
     * 响应消息
     */
    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
